Splits up a string into substrings depending on the given delimiters.
StringSplit ( "string", "delimiters" [, flag ] )
Parameters
string | The string to evaluate. |
delimiters | One or more characters to use as delimiters. |
flag | [optional] If flag is 0 (the default), then each character in the delimiter string will mark where to split the string. If flag is 1, then the entire delimiter string is needed to mark the split. |
Return Value
Returns an array, the first element ($array[0]) contains the number of strings returned, the remaining elements ($array[1], $array[2], etc.) contain the delimited strings.
Remarks
If you use a blank string "" for the delimiters, each character will be returned as an element.
Related
String, StringInStr, StringLeft, StringLen, StringLower, StringMid, StringReplace, StringRight, StringTrimLeft, StringTrimRight, StringUpper
Example
$days = StringSplit("Sun,Mon,Tue,Wed,Thu,Fri,Sat", ",")
;$days[1] contains "Sun" ... $days[7] contains "Sat"
$text = "This\nline\ncontains\nC-style breaks."
$array = StringSplit($text, '\n', 1)